# -*- coding:utf-8 -*-

# @File     :lyp_test
# @Author   :Yupeng
# @Date     :2018/10/26 19:59

'''
这个文件是我自己测试一下函数和用法的，前端人员不用在意，直接删除即可
'''


# import os
# import random
# from hte.utils.general import _get_type_name
# from django.conf import settings

# base_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# # base_dir = os.path.abspath(__file__)
# print(base_dir)
# a = 1, 'fasd'
# print(a[1])
# print(str(settings.BASE_DIR))
# b = os.path.join(settings.BASE_DIR, '/a')
# print(b)
#
#
# def test_generate_challenge():
#     chars, ret = 'abcdefghijklmnopqrstuvwxyz', ''
#     for i in range(4):
#         ret += random.choice(chars)
#     print(ret.upper())
#
#
# # test_generate_challenge()
#
# def test_super():
#     class room:
#         def __init__(self, area=120, usedfor='sleep'):
#             self.area = area
#             self.usedfor = usedfor
#
#         def display(self):
#             print("this is my house")
#
#     class babyroom(room):
#         def __init__(self, area=40, usedfor="son", wallcolor='green'):
#             super().__init__(area, usedfor)
#             self.wallcolr = wallcolor
#
#         def display(self):
#             super().display()
#             print("babyroom area:%s wallcollor:%s" % (self.area, self.wallcolr))
#
#     class rent:
#         def __init__(self, money=1000):
#             self.rentmoney = money
#
#         def display(self):
#             print("for rent at the price of %s" % self.rentmoney)
#
#     class agent(babyroom, rent):
#         # class agent(rent,babyroom):
#         def display(self):
#             super().display()
#             print("rent house agent")
#
#     agent().display()
#
#
# class Ustb(object):
#     name = 'Robyn'
#     __count = 456
#
#     def __init__(self, name):
#         self.name = name
#         self.age = 123
#
#     def fun(self):
#         print(self.name)
#
#
# def gendata():
#     mywords = ['foo', 'bar', 'baz']
#     for word in mywords:
#         yield {
#             "_index": "mywords",
#             "_type": "document",
#             "doc": {"word": word},
#         }
#
#
# def test_zip():
#     a = ('a', 'b', 'c', 'd', 'e')
#     b = (1, 2, 3, 4, 5)
#     for collection, index in zip(a, b):
#         print(collection)
#
#
# from elasticsearch_dsl import Search
#
#
# def test_search_from_dict():
#     s = Search.from_dict({
#         "query": {
#             "bool": {
#                 "must": []
#             }
#         },
#         "aggs": {"avg_grade": {"avg": {"field": "grade"}}}
#     })
#     # print(s)
#     s = s.filter('term', published=True)
#     print(s)
#
#
# def extract_data_string(data):
#     ret = ''  # ret==return
#     if isinstance(data, dict):
#         for k, v in data.items():
#             ret += k + ' '
#             ret += extract_data_string(v) + ' '
#     elif isinstance(data, str):
#         ret = data + ' '
#     elif isinstance(data, (int, float)):
#         ret = str(data) + ' '
#     elif isinstance(data, list):
#         for v in data:
#             ret += extract_data_string(v) + ' '
#     return ret
#
#
# # from apps.search.core.es_handler import Transform
#
# def transform_test():
#     from .es_handler import Transform
#     a = Transform.terms_dic('A', [3, 4])
#     print(a)

def merge_list(x, y):
    return [a + b for a, b in zip(x, y)]


if __name__ == '__main__':
    # string1 = {'a': "123", 'b': 423}
    # print(extract_data_string(string1))
    temp = merge_list([0, 2, 0, 0], [1, 2, 3, 4])
    print(temp)
